package com.example.asapp.demo.curd;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class CurdService {

    @Autowired
    CurdMapper curdMapper;

    public List<CurdVO> listQuery(CurdQuery curdQuery) {
        return curdMapper.listQuery(curdQuery);
    }

        public int add(CurdVO curdVO) {
            curdVO.setId(UUID.randomUUID().toString());
            return curdMapper.insertSelective(curdVO);
        }

        public int edit(CurdVO curdVO){
            return curdMapper.updateByPrimaryKey(curdVO);
        }

        public int delete(String id) {
            return curdMapper.deleteByPrimaryKey(id);
        }
}
